<template>
  <div class="messageList">
    <!-- 用户的头像 -->
      <van-image
        round
        fit="cover"
        :src="message.img"
        class="img"
        v-if="message.img"
      />
      <!-- 用户的名称 -->
      <h3 class="name">
        {{message.name}}
      </h3>
      <!-- 时间 -->
      <div class="time">{{message.time}}</div>
      <!-- 任务的标题 -->
      <p class="title" v-if="message.title">{{message.title}}</p>
      <!-- 任务的内容 -->
      <p class="content" v-if="message.content">{{message.content}}</p>
  </div>
</template>

<script>
export default {
  name: 'MessageList',
  props: {
    message: {
      type: Object,
      default() {
        return {}
      }
    }
  },
}
</script>

<style scoped>
  .messageList {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-bottom: 1px solid rgb(245, 245, 245);
    float: left;
  }
  .img {
    float: left;
    margin: 0 20px 0 0;
    border: 1px solid #cccccc;
    width: 60px;
    height: 60px
  }
  .name {
    float: left;
    padding: 0;
    margin: 0;
    color: #494949;
  }
  .title {
    float: left;
    font-size: 11px;
    padding: 0;
    margin: 0;
    width: 200px;
    color: rgb(122, 122, 122);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .time {
    font-weight: 600;
    font-size: 11px;
    float: right;
    color: #ccc;
  }
  .content {
    float: left;
    font-size: 15px;
    padding: 0;
    margin: 5px 0;
    width: 70%;
    color: rgb(122, 122, 122);
    font-weight: 501;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
</style>